package com.silence.gankio.mvvm.model

import com.silence.gankio.bean.GankIoData
import com.silence.gankio.core.net.HttpUtil
import com.silence.gankio.net.GankIoModelObserver
import com.silence.gankio.service.GankIoService
import com.silence.gankio.sp.SplashSP

class GankModel : BaseModel() {

    fun loadAndroid(page: Int, number: Int = 10) {
        load(HttpUtil().getService(GankIoService::class.java).福利(1, 1), object :
            GankIoModelObserver<GankIoData>(this) {
            override fun onSuccess(t: GankIoData) {
                val imageUrl = t.url
                if (SplashSP.INSTANCE.getImageUrl() != imageUrl) {
                    SplashSP.INSTANCE.setImageUrl(imageUrl)
                }
            }
        })
    }

}